unit U_VardiyaTanimKart;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, FormClassEkran, ImgList, XPMan, StdActns, ActnList, fcStatusBar,
  StdCtrls, Buttons, ExtCtrls, wwdbdatetimepicker, DB, ADODB, Mask,
  wwdbedit, wwdblook;

type
  TfmVardiyaTanimKart = class(TfmFormClassEkran)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    PazartesiBas: TwwDBDateTimePicker;
    Label2: TLabel;
    PazartesiBit: TwwDBDateTimePicker;
    Label3: TLabel;
    SaliBas: TwwDBDateTimePicker;
    SaliBit: TwwDBDateTimePicker;
    Label4: TLabel;
    CarsambaBas: TwwDBDateTimePicker;
    CarsambaBit: TwwDBDateTimePicker;
    Label5: TLabel;
    PersembeBas: TwwDBDateTimePicker;
    PersembeBit: TwwDBDateTimePicker;
    Label6: TLabel;
    CumaBas: TwwDBDateTimePicker;
    CumaBit: TwwDBDateTimePicker;
    Label7: TLabel;
    CumartesiBas: TwwDBDateTimePicker;
    CumartesiBit: TwwDBDateTimePicker;
    Label8: TLabel;
    PazarBas: TwwDBDateTimePicker;
    PazarBit: TwwDBDateTimePicker;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    Label14: TLabel;
    aqEntry: TADOQuery;
    dsEntry: TDataSource;
    GroupBox2: TGroupBox;
    Label15: TLabel;
    VardiyaAdi: TwwDBEdit;
    Label16: TLabel;
    Aciklama: TwwDBEdit;
    Label17: TLabel;
    Label18: TLabel;
    adoMolaTanim: TADOQuery;
    procedure acKaydetYeniExecute(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormShow(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmVardiyaTanimKart: TfmVardiyaTanimKart;

implementation

uses U_VardiyaTanim, FormClass, FormClassEmptyList, Boxes, data;

{$R *.dfm}

procedure TfmVardiyaTanimKart.acKaydetYeniExecute(Sender: TObject);
begin
  inherited;
  if (UseType in [futInsert, futEdit]) then
  begin
    aqEntry.Post;

    if Assigned(fmVardiyaTanim) then
      fmVardiyaTanim.aqEntry.Requery;
    if (Sender as TComponent).Tag = 2 then
    begin
      Close;
    end
    else
      if (Sender as TComponent).Tag = 1 then
      begin
        UseID := '0';
        UseType := futInsert;
        FormShow(Sender);
      end;
  end;
end;

procedure TfmVardiyaTanimKart.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  inherited;
  Action := caFree;
  fmVardiyaTanimKart := nil;
end;

procedure TfmVardiyaTanimKart.FormShow(Sender: TObject);
begin
  inherited;
  OpenQueryOnDataSet(aqEntry.SQL.Text, aqEntry, ['id'], [UseID]);

  if UseType in [futInsert] then
  begin
    aqEntry.Insert;
    ComponentRenklendir(Self, True);
  end;

  if UseType in [futEdit] then
  begin
    aqEntry.Edit;
    ComponentRenklendir(Self, True);
  end;

  if UseType in [futInspection] then
  begin
    ComponentRenklendir(Self, False);
  end;
end;

procedure TfmVardiyaTanimKart.FormCreate(Sender: TObject);
begin
  inherited;
  OpenQueryOnDataSet(adoMolaTanim.SQL.Text, adoMolaTanim);
end;

end.

